package id.mankel.commons.util;

import org.apache.commons.lang3.StringUtils;

/**
 * Validates:
 * <ol>
 *     <li>if required</li>
 *     <li>if matches required format</li>
 * </ol>
 * @author Mankel
 */
public class MkValidators {

    public static final String REGEX_ACCOUNT = "^(?=^.{8,20}$)(?=^[a-zA-Z]+)\\w+$";
    public static final String REGEX_PASSWORD = "";
    public static final String REGEX_EMAIL = "";

    /**
     * Validates if required
     * @param s
     * @return
     */
    public static boolean requires(String s) {
        return StringUtils.isNotBlank(s);
    }

    /**
     * Validates if required and matching the format
     * @param s
     * @param regex required format
     * @return
     */
    public static boolean requiresAndMatches(String s, String regex) {
        return requires(s) && s.matches(regex);
    }

}
